<ion-view view-title=任务列表 >
  <ion-content>
    <ion-refresher on-refresh="doRefresh()"
                   pulling-text="下拉刷新..."
                   refreshing-text="拼命加载中..."
                   refreshing-icon="ion-loading-b">

    </ion-refresher>
      <div class="list card" ng-repeat="task in tasks" href="#">
        <div>
          <div class="item">
            <h2>{{task.get('area_name')}}-
              <span  style="color: red;">{{task.get('type') | orderTypeName}}</span>
              <!--<span ng-if="(task.get('type') === 9)">商家外卖</span>-->
              <span ng-bind-html="task.get('code') | colorString"> </span>

              <a class="float-right" style=" color: orange" ng-if="task.get('status')==7000 || task.get('status')==8000" ng-click="bookTime(event,task.get('code'))">预约</a>
            </h2>
          </div>
          <div class="item item-body">
            <p>
              <i class="icon ion-ios-home" style="font-size: x-large;color: orange;"></i>
              {{task.get('to_address')}}
            </p>
            <p>
              <i class="icon ion-ios-people" style="font-size: x-large;color: orange;"></i>
              {{task.get('to_name')}}
              <a href="tel:{{task.get('to_tel')}}">{{task.get('to_tel')}}</a>
              <a href="tel:{{task.get('to_tel')}}" class="icon ion-ios-telephone"></a>
            </p>
            <p >
              <i class="icon ion-arrow-graph-up-right" style="font-size: x-large;color: orange;"></i>
              {{task.get('status') |  orderState }}
            </p>
            <p ng-if="task.get('book_time') !=undefined">
              预约时间：{{task.get('book_time') | date : 'yyyy-MM-dd HH:mm:ss'}}
            </p>
          </div>
          <div class="row ">
            <div class="col" ng-show="task.get('status') === 8000 || task.get('status') === 7000">
              <button class="button button-assertive button-small button-block" ng-click="finishExpress(event,task.get('code'),task)">
                <i class="icon ion-android-walk "></i>
                <b>完成</b>
              </button>
            </div>
            <div class="col" ng-show="task.get('status') === 8000 || task.get('status') === 7000">
              <button class="button button-balanced button-small button-block" ng-click="reject(event,task.get('code'),task)">
                <i class="icon ion-sad-outline "></i>
                <b>拒收</b>
              </button>
            </div>
            <div class="col">
              <button class="button button-calm button-small button-block" ng-click="gotoDetail(event,task.get('code'))">
                <i class="icon ion-ios-book-outline "></i>
                <b>详情</b>
              </button>
            </div>
          </div>
        </div>
      </div>

    <div ng-if="(tasks.length == 0)" class="card">
      <div class="item item-text-wrap">
        啥都没有~~
      </div>
    </div>
    <div style="text-align: center" ng-if="(loadmore.more === true)">
      <a style="color: green;text-align: center" ng-click="getMore()" >加载更多</a>
    </div>
    <div style="text-align: center" ng-if="(loadmore.more === false)">
      <a style="color: green;text-align: center" >~没有了~</a>
    </div>
  </ion-content>
</ion-view>
